#ifndef SHOW_HPP_INCLUDED
#define SHOW_HPP_INCLUDED

#include "Process/observer.hpp"
#include "Process/process.hpp"

#include "Frame/states.hpp"

#include <fstream>
#include "image.h"
#include <string>
#include <cstring>
#include <vector>
#include <iostream>
#include <math.h>

using namespace std;

class Point
{
public:
	Point(){x=0;y=0;};
	Point(double _x, double _y):x(_x),y(_y){};
	~Point(){};
	double x, y;
};

class Trajectory
{
public:
	Trajectory();
	Trajectory(string src){load(src);}
	~Trajectory(){};
	void load(string src);
	void init();
	void smooth(int n);

	vector<Point> location;

	vector<Point> v;
	vector<Point> a;
};

class AttentionProcess
{
    public:
    AttentionProcess(){};

    int ts,te;
    double influence;
};

class AttentionInfluence
{
    public:
    void init();
    double value(int ts, int te);
    vector<double> influence;
    vector<vector<AttentionProcess> > Ap;
};

class Person
{
public:
	Person();
	~Person(){};
	void load(string src);
	void smooth(int n);
	//void GetTP();
	//double ComputAccTpt(int ts, int te);

	Trajectory head,hand_l,hand_r;
	vector<Point> headpose;
	vector<Point> real_headpose;
	vector <double> hp_l;
	vector<double> _headpose;

	vector<vector<double> > Attention;
    vector<vector<AttentionProcess> > AttentionProcessList;
    vector<AttentionInfluence> Interaction;
	vector<double> Acc;
	vector<Point> TP;

	vector<int> Att;

	//static float Threshold_TP;
private:

};

class  Show:public Observer
{
public:
	Show(Process *pro, States *_state);
	~Show();

	void Update(const Image &image);
	void GetAtt();
	void GetAp();
	void GetInteraction();
	//void GetInfluence(int ts, int te);
	//int GetDeltaT(int personto, int personfrom, int timet);

	Image out;
protected:
private:
	States *state;

	std::ofstream outFile;

	double sigma_1, sigma_2, ssigma;
	double Alpha;
    double Threshold;

	int t_count;

	int num;
	Person p[3];

	//vector<vector<vector<double> > > Attention;
	vector<vector<AttentionInfluence> > Interaction;
    //vector<vector<vector<AttentionProcess> > > AttentionProcessList;

	//vector<vector<TrajectoryInfluence> > AllInfluence;
};

#endif // SHOW_HPP_INCLUDED
